<script language="javascript">
   $(document).ready(function() {
    $('#newstable').dataTable( {
        "bJQueryUI": true,
        "sPaginationType": "full_numbers",
     "aaSorting": [[ 0, "desc" ]]
    } );
} );

</script>
<?php
if($this->stat == "added")
{
?>
	<div id="success_msg">News successfully saved</div>
<?php
} else if ($this->stat == "updated") {
?>
	<div id="success_msg">News successfully updated</div>
<?php
} else if ($this->stat == "deleted") {
?>
	<div id="success_msg">News successfully deleted</div>
<?php
}
?>
<?php
echo $this->adminToolBar('news', 'index', '/admin/news/add/', '/admin/hotel/edit/', '/admin/hotel/delete/', '');
?>

<?php
if(!empty($this->news_arr_main['news_title']) || !empty($this->news_arr_main['news_desc']))
{
?>
<table width="75%" class="adminlist">
	<thead>
		<tr>
			<th width="30%">Main Title</th>
			<th width="45%">Main Description</th>			
			<th width="5%">&nbsp;</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td><?php echo $this->news_arr_main['news_title']; ?></td>
			<td><?php echo $this->news_arr_main['news_desc']; ?></td>
			<td><a href="/admin/news/editdefaultcontent/id/<?php echo $this->news_arr_main['news_id']; ?>"><img src="/images/admin/icons/edit.gif" width="15" height="15" /></a></td>
		</tr>
	</tbody>
</table>
<?php 
} else {
?>
<div id="error_msg" style="float: left;">Empty recordset. No default content to display</div>

<div id="add_default_content" style="float: left; clear: both;"><a href="#" class="show_hide"><img src="/images/admin/icons/add.png" width="32" height="32" />Add default content</a></div>
<div class="dataform" style="display: none;">
	<table border="0" width="100%">
		<tr>
			<td valign="top">Main Title</td>
			<td valign="top"><input type="text" name="news_title" id="news_title" value="" class="inputbox" /></td>
		</tr>
		<tr>
			<td valign="top">Main Description</td>
			<td valign="top"><?php echo $this->editorFck('news_desc', '', '100%', 200); ?></td>
		</tr>
		<tr>
			<td valign="top">&nbsp;</td>
			<td valign="top"><a href="javascript: void(0);" onclick="addDefaultNewsContent();"><img src="/images/admin/icons/save-2.gif" />&nbsp;Save</a></td>
		</tr>
	</table>
</div>
<?php
}
?>
<div style="line-height: 60px;">&nbsp;</div>
<?php
if(count($this->news_arr) > 0)
{
?>

<table id="newstable" width="100%" class="adminlist">
	<thead>
		<tr>
			<th width="3%">ID</th>
			<th width="30%">Title</th>
			<th width="40%">Description</th>
			<th width="3%">Status</th>
			<th width="10%">Date</th>
			<th width="2%">Hits</th>
			<th width="2%">&nbsp;</th>
			<th width="2%">&nbsp;</th>
		</tr>
	</thead>
	<?php
		foreach ($this->news_arr as $news_entry) :
			if($news_entry['status'] == 1)
			{
				$status = "<img src='/images/admin/publish.png' title='unpublish' />";
			} else {
				$status = "<img src='/images/admin/publish_x.png' title='publish' />";
			}			
	?>
	<tbody>
		<tr>
			<td><?php echo $news_entry['news_id']; ?></td>
			<td><?php echo $news_entry['news_subtitle']; ?></td>
			<td><?php echo substr(stripslashes($news_entry['news_sub_desc']), 0, 200) . "..."; ?></td>
			<td align="center"><a href="javascript: void(0);" onclick="changeNewsStatus('<?php echo $news_entry['news_id']; ?>')"><?php echo $status; ?></a></td>
			<td><?php echo $news_entry['created_date']; ?></td>
			<td><?php echo($news_entry['hits'] == "")?0:$news_entry['hits']; ?></td>
			<td><a href="/admin/news/edit/id/<?php echo $news_entry['news_id']; ?>"><img src="/images/admin/icons/edit.gif" width="15" height="15" /></a></td>
			<td><a href="javascript: void(0);" onclick="deleteNews('<?php echo $news_entry['news_id']; ?>')"><img src="/images/admin/icons/delete.gif" width="18" height="18" /></a></td>
		</tr>
	</tbody>
	<?php
		endforeach;
	?>
</table>
<?php 
} else {
?>
<div id="error_msg" style="float: left;">Empty recordset. No news to display</div>
<?php
}
?>